<!--<div class="wide form">-->
<?php //$form=$this->beginWidget('CActiveForm', array(
	//'action'=>Yii::app()->createUrl($this->route),
	//'method'=>'post',
//)); ?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'search_form',
)); ?>
<fieldset class="classFieldSet">
    <legend>Tìm lớp</legend>
<table>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Mã gia sư'); ?></td>
        <td class="dataInput"><input type="text" name="id_tutor" size="10"></td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Tên gia sư'); ?></td>
        <td class="dataInput"><input type="text" name="tutor_name" size="20"></td>
    </tr>
    
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Quận có thể dạy'); ?></td>
        <?php
            $district_list = District::model()->findAll();
            $district_num  = count($district_list);
            $row_num = $district_num/4;
            if(($district_num%4) != 0) {
                $row_num+=1;
            }
            $pointer = 0;

        ?>
        <td class="dataInput">
            <table>
                <tr>
                    <input type="checkbox" name="district_list[]" value="0" checked="true" style="display: none"/>
                    <?php for($i=0; $i < 4; $i++) {?>
                    <td>
                        
                        <?php
                            $district_list = District::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                            foreach ($district_list as $district) {
                        ?>
                            <input type="checkbox" name="district_list[]" value="<?php echo $district->id;?>"><?php echo $district->name;?><br>
                        <?php } ?>
                    </td>
                    <?php
                        $pointer+=$row_num;
                    }
                    ?>
                </tr>
            </table>

        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Môn có thể dạy'); ?></td>
        <?php
            $subject_list = Subject::model()->findAll();
            $subject_num  = count($subject_list);
            $row_num = $subject_num/4;
            if(($subject_num%4) != 0) {
                $row_num+=1;
            }
            $pointer = 0;

        ?>
        <td class="dataInput">
            <table>
                <tr>
                    <input type="checkbox" name="subject_list[]" value="0" checked="true" style="display: none"/>
                    <?php for($i=0; $i < 4; $i++) {?>
                    <td>
                        
                        <?php

                            $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                            foreach ($subject_list as $subject) {
                        ?>
                            <input type="checkbox" name="subject_list[]" value="<?php echo $subject->id;?>"><?php echo $subject->name;?><br>
                        <?php } ?>
                    </td>
                    <?php
                        $pointer+=$row_num;
                    }
                   ?>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Giáo viên'); ?></td>
        <td class="dataInput">
            <input type="radio" name="is_teacher" value="1"/>Đúng
            <input type="radio" name="is_teacher" value="0"/>Sai
            <input type="radio" name="is_teacher" value="2" checked="true"/>Không phân biệt
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Muốn nhận lớp giáo viên'); ?></td>
        <td class="dataInput">
            <input type="radio" name="want_teacher_course" value="1"/>Đúng
            <input type="radio" name="want_teacher_course" value="0"/>Sai
            <input type="radio" name="want_teacher_course" value="2" checked="true"/>Không phân biệt
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Giới tính'); ?></td>
        <td class="dataInput">
            <input type="radio" name="sex" value="1"/>Nam
            <input type="radio" name="sex" value="0"/>Nữ
            <input type="radio" name="sex" value="2" checked="true"/>Không phân biệt
        </td>
    </tr>
    <tr>
        <td class="titleInput"><?php echo CHtml::encode('Trạng thái'); ?></td>
        <td class="dataInput">
            <input type="radio" name="status" value="1"/>Có lớp
            <input type="radio" name="status" value="0"/>Chưa có lớp
            <input type="radio" name="status" value="2" checked="true"/>Cả hai
        </td>

    </tr>
</table>
	<div class="row buttons">
                 <?php
                            echo CHtml::ajaxSubmitButton(
                                'Thống kê',
                                array('tutor/search'),
                                array(
                                    'update'=>'#result',
                                )
                            );
                        ?>
	</div>

</fieldset>
<?php $this->endWidget(); ?>
<div id="result">
</div>
<!--</div> search-form -->